//===============================================================================
// Microsoft patterns & practices
// Web Client Software Factory
//-------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//-------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================
using System;
using System.Collections.Specialized;
using System.Xml;
using System.Xml.XPath;


namespace WCSFContrib.PageFlow.Xml.Configuration
{
    /// <summary>
    /// The StatePersistenceProviderSettings class is a representation of the 
    /// state persistence configuration defined in the configuration file.
    /// </summary>
    public class StatePersistenceProviderSettings : ObjectTypeSettings
    {
        #region Declares Variables
        private NameValueCollection _attributes;
        #endregion

        #region Constructor

        /// <summary>
        /// Creates an instance of the StatePersistenceProviderSettings class using the specified configNode.
        /// </summary>
        public StatePersistenceProviderSettings(IXPathNavigable configNode)
            : base(configNode)
        {
            LoadAttributes((XmlNode)configNode);
        }

        private void LoadAttributes(XmlNode configNode)
        {
            _attributes = new NameValueCollection();
            foreach (XmlAttribute currentAttribute in configNode.Attributes)
            {
                _attributes.Add(currentAttribute.Name, currentAttribute.Value);
            }
        }
        #endregion

        #region Properties

        /// <summary>
        /// Gets the state persistence attributes.
        /// </summary>
        public NameValueCollection AdditionalAttributes
        {
            get { return _attributes; }
        }
        #endregion
    }
}
